#line 1 "C:/Users/Maxime/Documents/Progc/16f887/LCD/LCD.c"





sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;


char txt1[] = "Bonjour";
char txt2[] = "Maxime";
char txt3[] = "LCD";
char uart[] = "UART";
char i2c[] = "I2C";
char txt5[] = "Data UART Rx :";
char initchar[] = "                ";
char i,uart1;
char uart_rd[17]="                " ;
char barre[] = "|";


void Move_Delay() {
 Delay_ms(500);
}

void main(){
 PORTD = 0x00;
 TRISD = 0b00000100;
 ANSEL = 0;
 ANSELH = 0;
 C1ON_bit = 0;
 C2ON_bit = 0;

  PORTD.RD0  = 1;
 UART1_Init(9600);
 Delay_ms(100);
  PORTD.RD0  = 0;

 Lcd_Init();

 Lcd_Cmd(_LCD_CLEAR);
 Lcd_Cmd(_LCD_CURSOR_OFF);
 Lcd_Out(1,7,txt3);

 Lcd_Out(2,7,uart);
 Delay_ms(2000);
 Lcd_Cmd(_LCD_CLEAR);

 Lcd_Out(1,5,txt1);
 Lcd_Out(2,6,txt2);

 Delay_ms(2000);
#line 72 "C:/Users/Maxime/Documents/Progc/16f887/LCD/LCD.c"
 Lcd_Cmd(_LCD_CLEAR);
#line 95 "C:/Users/Maxime/Documents/Progc/16f887/LCD/LCD.c"
 while(1) {
 Lcd_Cmd(_LCD_CLEAR);
 Lcd_Out(1,2,uart);
 Lcd_Out(1,8,barre);
 Lcd_Out(1,9,barre);
 Lcd_Out(2,8,barre);
 Lcd_Out(2,9,barre);

 for(i=0;i<16;i++){uart_rd[i]=' ';}
#line 114 "C:/Users/Maxime/Documents/Progc/16f887/LCD/LCD.c"
 if (UART1_Data_Ready()) {
  PORTD.RD0 =1;

 UART1_Read_Text(uart_rd,' ',255);






 Lcd_Out(2,1,uart_rd);
  PORTD.RD0 =0;
  PORTD.RD1 =1;
 Delay_ms(500);
  PORTD.RD1 =0;


 }
 }
}
